<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\widgets\LinkPager;
use yii\helpers\Url;
use common\models\Order;
$this->params['breadcrumbs'][] = $this->title;

?>
<div class="countCenter haveBuyGoods">
  <div class="mcCont">
    
      <div class="right cont">
        <h1 class="tt2">已买到的货品</h1>
        <ul class="hbgNavs autoHeight">
          <li><a href="/order" <?php if(!Yii::$app->request->get('s'))echo "style='color:#31a900;border-bottom-color:#31a900'"; ?>>全部订单</a></li>
          <?php foreach ($count as $key => $value): ?>
              <li>
              <a href="/order?s=<?=$key?>" <?php if(Yii::$app->request->get('s') == $key)echo "style='color:#31a900;border-bottom-color:#31a900'"; ?>>
                <?=Html::encode($value['name'])?><em class="number"> <?=Html::encode($value['num'])?></em>
              </a>
              </li>
          <?php endforeach ?>

        </ul>
      <?php if ($order): ?>
        <?php foreach ($order as $k => $v): ?>

          <?php if ($v['order_status'] == 4/*完成*/ || $v['order_status'] == 5/*取消*/): ?>
            <div class="waitForpay haveClosed complete">
          <?php else: ?>
              <div class="waitForpay">
          <?php endif ?>

              <div class="ttInfo">
                <h1 class="tt1"><?=Html::encode(Order::itemAlias('order_status',$v['order_status']))?>
                  <span class="right tt2">订单金额：
                  <em>￥<?=Html::encode($v['pay_fee'])?></em>
                  </span>
                </h1>
                <p class="tt3">
                  <span class="time mr20"><?=Html::encode($v['create_time'])?></span>
                  <a href="" class="inlineBlock orederNumber">订单号：<?=Html::encode($v['id'])?></a>
                  <span class="username ml20">
                    <i class="iconfont icon-user"></i>  <?=Html::encode($v['name'])?>
                  </span>
                  <?php if ($v['shipping_fee'] > 0): ?>
                      <span class="total right">（含运费：￥<?=Html::encode($v['shipping_fee'])?>）</span>
                  <?php endif ?>
                </p>
              </div>
              <div class="contInfo">
                <ul class="lists">
                  <?php foreach ($v['list'] as $key => $va): ?>
                    <li>
                      <a href="<?= Url::toRoute(['product/'.$va['product_id']]);?>">
                        <div class="imge"><img src="<?=Html::encode($va['img_url'])?>!s50x50"></div>
                        <p class="name">【<?=Html::encode($va['name'])?>】 <?=Html::encode($va['title'])?></p>
                      </a>
                      <span class="onetotal">￥<?=Html::encode($va['price']." x ".$va['product_num'])?></span>
                      <span class="price">￥<?=Html::encode($va['total_price'])?></span>

                      <?php if ($v['order_status'] == 4): ?>
                        <!-- <a href="" class="return">退货/换货</a>
                        <a href="" class="btn-small-default">评价</a> -->
                      <?php endif ?>

                    </li>
                  <?php endforeach ?>
                </ul>

                <?php if ($v['order_status'] == 1): ?>
                  <?php if (count($v['list'])>1): ?>
                      <div class="btns">
                        <a <?php echo "style='margin-top:".(25*count($v['list'])-30)."px'" ?> href="/order/pay/<?=Html::encode($v['id'])?>" class="btn-small-default">立即付款</a>
                        <a <?php echo "style='margin-top:".(25*count($v['list'])-30)."px'" ?> href="/order/<?=Html::encode($v['id'])?>" class="btn-small-empty">订单详情</a>
                      </div>
                  <?php else: ?>
                      <div class="btns">
                        <a style="margin-top:3.5px;"  href="/order/pay/<?=Html::encode($v['id'])?>" class="btn-small-default">立即付款</a>
                        <a style="margin-top:3.5px;" href="/order/<?=Html::encode($v['id'])?>" class="btn-small-empty">订单详情</a>
                      </div>
                  <?php endif ?>
                  
                <?php else: ?>
                  <div class="btns">
                    <a href="/order/<?=Html::encode($v['id'])?>" class="btn-small-empty">订单详情</a>
                  </div>
                <?php endif ?>
                
              </div>
            </div>
        <?php endforeach ?>
        
      <?php else: ?>
        <div class="nullInfo">暂无相关订单记录 <i class="iconfont icon-xinfeng"></i></div>
      <?php endif ?>

      </div>
    </div>
  </div>

  <div class="mask" style="display: none"></div>
  <!--<div class="evalutePop">-->
    <!--<h1 class="tt0">评价商品</h1>-->
    <!--<div class="goodsInfo">-->
      <!--<img src="" alt="" class="imge">-->
      <!--天壤可可粉，可可粉的价格，好的可可粉-->
    <!--</div>-->
    <!--<div class="evalute">-->
      <!--<span class="item"><em>商品</em><span class="stars"><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i></span></span>-->
      <!--<span class="item"><em>服务</em><span class="stars"><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i></span></span>-->
      <!--<span class="item"><em>物流</em><span class="stars"><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i></span></span>-->
      <!--<p class="tipInfo">请对以上三项打分哦</p>-->
    <!--</div>-->
    <!--<div class="evaluteTxt">-->
      <!--<textarea name="" id="" class="inputArea" placeholder="商品是否给力？快分享您的感受吧~"></textarea>-->
      <!--<span class="txt">评价</span>-->
    <!--</div>-->
    <!--<a href="" class="btn-small-default">提交评价</a>-->
  <!--</div>-->

  <div class="hasEvalutePop" style="display:none">
    <h1 class="tt0">评价商品</h1>
    <div class="goodsInfo">
      <img src="" alt="" class="imge">
      天壤可可粉，可可粉的价格，好的可可粉
    </div>
    <div class="evalute">
      <span class="item"><em>商品</em><span class="stars"><i class="iconfont icon-starfull hover"></i><i class="iconfont icon-starfull hover"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i></span></span>
      <span class="item"><em>服务</em><span class="stars"><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i></span></span>
      <span class="item"><em>物流</em><span class="stars"><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i><i class="iconfont icon-starfull"></i></span></span>
    </div>
    <div class="evaluteTxt">
      <span class="evaluteNote">您的商品实在太好了，太好了商品，歇息诶</span>
      <span class="txt">评价</span>
    </div>
    <p class="btn"><a href="" class="btn-small-default">关闭</a></p>

  </div>

</div>
</div>

<script>
  $(function(){

    var $stars=$('.evalutePop .evalute').find('.stars').children('.iconfont');
    $stars.on('mouseenter',function(){
      var $index=$(this).index();
      var $current=$(this).parent().find('.iconfont');
      $current.removeClass('hover');
      for(var i=0;i<=$index;i++){
        $current.eq(i).addClass('hover');
      }
    }).on('mouseleave',function(){
      var $index1=$(this).index();
      var $current=$(this).parent().find('.iconfont');

      if($current.hasClass('selected')){
        var index11=$(this).parent().children('.selected').index();
        $current.removeClass('hover');
        for(var i=0;i<=index11;i++){
          $current.eq(i).addClass('hover');
        }
      }else {
        $current.removeClass('hover');
      }
    });
    $stars.on('click',function(){
      var $current=$(this).parent().find('.iconfont');
      var $index1=$(this).index();
      $current.removeClass('selected');
      $(this).addClass('selected');
      for(var i=0;i<=$index1;i++){
        $current.eq(i).addClass('hover');
      }
    });


  })
</script>